package com.silp.phoneinfo;

import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class Network extends PhoneInfoActivity {



	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

		Info myinfo = new Info(this);
		String NW = "" + myinfo.Get_NetWork(tm);
		String IMSI = "" + myinfo.Get_IMSI(tm);
		String IMEI = "" + myinfo.Get_IMEI(tm);
		int LAC = myinfo.Get_LAC(tm);
		String DataState = myinfo.Get_DataState(tm);
		String MCC = "" + myinfo.Get_MCC(tm);
		String MNC = ""+myinfo.Get_MNC(tm);
		String ICCID = "" + myinfo.Get_ICCID(tm);
		Boolean isWifiConnected=Info.IsWiFiConnected(getApplicationContext());
		Boolean isNetConnected=Info.isNetConnected(getApplicationContext());
		String WifiMacAddress = myinfo.getWiFiMACAddress(getApplicationContext());
		String WifiSSID = myinfo.getWiFiSSID(getApplicationContext());
		String IpAdd = myinfo.getWifiIpAddress(getApplicationContext());
		String[] networkinfostr = new String[]{


				"NetWork:	"+NW,
				"IMSI:	"+IMSI,
				"IMEI:	"+IMEI,
				"LAC:	"+LAC,
				"MCC:	"+MCC,
				"MNC:	"+MNC,
				"Serial Number:	"+ICCID,
				"Data State: " +DataState,
				"Internet Connection: "+isNetConnected,
				"Wifi is connected:"+ isWifiConnected,
				"Wifi Mac Address:" + WifiMacAddress,
				"Wifi SSID: "+ WifiSSID,
				"Wifi IP Address: "+IpAdd


		};

		setListAdapter(new ArrayAdapter<String>(this, R.layout.main, networkinfostr));
		ListView l = getListView();
		l.setTextFilterEnabled(true);
		l.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

				Toast.makeText(getApplicationContext(), ((TextView) view).getText(),Toast.LENGTH_SHORT).show();
			}
		});
	}



}


